package code.class2;

import common.ArrayUtils;

import java.util.Arrays;

/**
 * https://leetcode.cn/problems/merge-sorted-array/?envType=problem-list-v2&envId=array
 * 合并两个有序数组
 */
public class Code07_merge {
    public static void main(String[] args) {
        int[] nums1 = {2,0}, nums2 = {1};
        int m = 1, n = 1;
        merge(nums1, m, nums2, n);
        ArrayUtils.printArr(nums1);

    }

    public static void merge(int[] nums1, int m, int[] nums2, int n) {
        for (int i = 0; i < n; i++) {
            nums1[i + m] = nums2[i];
        }
        Arrays.sort(nums1);
    }


}
